<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>My JSP 'formTags.jsp' starting page</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

	</head>

	<body>
		<form>
			姓名：<input type="text" name="name"/><br/>
			密码：<input type="password" name="password"/><br/>
			<input type="submit" value="submit"/>
		</form>
		<hr/>
		<!-- 普通表单标签 -->
		<s:form><!-- theme默认为xhtml -->
			<s:textfield name="name" label="姓名" labelposition="left"></s:textfield><!-- 默认labelposition为left -->
			<s:password name="password" label="密码"  showPassword="true"></s:password>
			<s:textarea name="descript" label="简介" cols="16" rows="5"></s:textarea>
			<s:hidden name="name"></s:hidden>
			<s:checkbox name="yes_no" label="agree?"></s:checkbox>
			<s:checkboxlist name="citys" label="喜爱的城市" list="opts" listKey="key" listValue="value"></s:checkboxlist>
			<s:radio name="city" list="opts" listKey="key" listValue="value" ></s:radio>
			<!-- emptyOption或者headerKey and headerValue 任选一个 -->
			<s:select emptyOption="true" headerKey="0" headerValue="--请选择--"  name="city" list="opts" listKey="key" listValue="value" ></s:select>
			<s:select multiple="true" size="5" name="citys" list="opts" listKey="key" listValue="value"></s:select>
			<s:submit value="submit"></s:submit>
		</s:form>
		<s:form theme="simple">
			<s:textfield name="name" label="姓名" ></s:textfield>
			<s:password name="password" label="密码"></s:password>
			<s:submit value="submit"></s:submit>
		</s:form>
		<hr/>
	<!-- 集合合并append,merge -->
	<s:bean name="entity.UserList" var="users"></s:bean>
	<s:merge var="mergebean">
		<s:param value="#users.males"></s:param>
		<s:param value="#users.females"></s:param>
	</s:merge>
	<ul>
	<s:iterator value="#mergebean">
	<li>${name }</li>
	</s:iterator>
	</ul>
	<hr/>
	<s:append var="appendbean">
		<s:param value="#users.males"></s:param>
		<s:param value="#users.females"></s:param>
	</s:append>
	<ul>
	<s:iterator value="#appendbean">
	<li>${name }</li>
	</s:iterator>
	</ul>
	<hr/>
	<!-- option选项分组 -->
	<s:select name="id" list="{}">
		<s:optgroup label="男性"  list="#users.males" listKey="id" listValue="name"></s:optgroup>
		<s:optgroup label="女性"  list="#users.females" listKey="id" listValue="name"></s:optgroup>
	</s:select>
	<hr/>
	</body>
</html>
